package com.powernode.service.impl;

import com.powernode.commons.ResultEnum;
import com.powernode.commons.ResultException;
import com.powernode.mapper.GoodsMapper;
import com.powernode.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author X
 * @date 2021/10/28
 */
@SuppressWarnings({"all"})
@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;
    @Override
    public List<Goods> findByList() {
        List<Goods> goods = goodsMapper.selectAll();
        if (goods.isEmpty()){
            throw new ResultException(ResultEnum.DATA_NOT_FOUND);
        }
        goods.get(0).setG_id("8081");
        return goods;
    }
}
